<!DOCTYPE html>
<html>
    <head>
        <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
        <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.9/css/bootstrap-dialog.min.css" rel="stylesheet" type="text/css" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.9/js/bootstrap-dialog.min.js"></script>
        <title>Append modal to div</title>
        <meta charset="utf-8" />
    </head>
    <body>
        <div id="modal-container"></div>
        <script type="text/javascript">
            /**
             * This example demonstrates how to append modal stuff to a div other than body.
             */
            $(function () {
                var dialog = new BootstrapDialog({
                    title: 'Not in body',
                    message: 'But somewhere else.'
                });
                dialog.realize();
                $('#modal-container').append(dialog.getModal());
                dialog.open();
            });
        </script>
    </body>
</html>
